Skip to content

Instantly share code, notes, and snippets.

@gamaup
Last active December 9, 2019 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gamaup/aab5e5ed183fdb448fb21d837438d1cf to your computer and use it in GitHub Desktop.
Save gamaup/aab5e5ed183fdb448fb21d837438d1cf to your computer and use it in GitHub Desktop.
Filter Kurir Rajaongkir pada Plugin Ongkos Kirim
<?php
add_filter('pok_rates', 'filter_couriers', 10, 2);
function filter_couriers($rates, $package) {
$filtered_rates = array();
$selected_courier = array(
'JNE - REG',
'JNE - OKE',
'JNE - YES'
);
foreach ($rates as $r) {
if (in_array($r['class'], $selected_courier)) {
$filtered_rates[] = $r;
}
}
return $filtered_rates;
}
?>
@gamaup
Copy link
Author

gamaup commented Apr 28, 2017

Sesuaikan $selected_courier dengan nama layanan yang dikehendaki. Pilihan nama-nama layanan bisa dilihat dengan cara mencoba melakukan checkout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment